package com.coderman.domainservice.blogtopic.app.query;

import com.coderman.domainservice.blogtopic.client.dto.BlogAggregateDTO;
import com.coderman.domainservice.blogtopic.client.dto.BlogDTO;
import com.coderman.domainservice.blogtopic.domain.gataway.BlogRepository;
import com.coderman.domainservice.blogtopic.infrast.elastic.ESBlogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Description:
 * date: 2021/4/9
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@Service
public class BlogQueryService {

    @Autowired
    private BlogRepository blogRepository;


    @Autowired
    private ESBlogRepository esBlogRepository;

    public BlogAggregateDTO getOneBlog(Long blogId){
         blogRepository.findOneBlog(blogId);
         return null;
    }


    public List<BlogDTO>  searchBlog(String content){
        List<BlogDTO> list = esBlogRepository.query(content);
        for (BlogDTO blogDTO : list){
            //聚合查询结果
            //1.调用redis统计服务
            //2.调用数据库获取博客周边数据信息

        }
        return list;
    }


}
